/*************************************************************************
	> File Name: B3715.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-01-10 11:15:55
 ************************************************************************/

#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

void solve(long long n) {
    long long i = 2;
    while (i * i <= n) {
        while (n % i == 0) {
            cout << i << " ";
            n /= i;
        }
        i++;
    }
    if (n != 1) cout << n;
    cout << endl;
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        long long n;
        cin >> n;
        solve(n);
    }
    return 0;
}
